<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="../../common/init_context.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>国付宝收银台 - 订单</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link type="text/css" rel="stylesheet" href="${ROOT}/static/css/reset.css" media="all" />
    <link type="text/css" rel="stylesheet" href="${ROOT}/static/css/style.css" media="all" />
    <link type="text/css" rel="stylesheet" href="${ROOT}/static/css/ui-lightness/jquery-ui-1.9.2.custom.css" media="all" />
    <script type="text/javascript" src="${ROOT}/static/js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="${ROOT}/static/js/jquery-ui-1.9.2.custom.min.js"></script>
    <script type="text/javascript" src="${ROOT}/static/js/jquery.gopay.ext.js"></script>
    <script type="text/javascript" src="${ROOT}/static/js/jquery.alert.js"></script>
    <script type="text/javascript" src="${ROOT}/static/js/gopay/expressPayChannel.js"></script>
    <script type="text/javascript" src="${ROOT}/static/00100/javascripts/gopay/express/certNoChecker.js"></script>
    <script type="text/javascript" src="${ROOT}/static/js/gopay/ccfp/reselectBanks.js"></script>
    <!--[if IE 6]>
    <script src="../../javascripts/png_ie6fix.js" type="text/javascript"></script>
    <script type="text/javascript">
        EvPNG.fix("div, span,a");
    </script>

    <![endif]-->

    <script type="text/javascript">
        var ctx='${ctx}';
        $(function(){
            $("#cvn2No").bind("focus",function(){
                $("#cvn2PromptImg").show();
            });
            $("#cvn2No").bind("blur",function(){
                $("#cvn2PromptImg").hide();
            });
        });

        function checkCvn2No(){
            if($.trim($("#cvn2No").val()) == ''){
                $("#validCvn2NoTip").html('信用卡CVN2不能为空');
                return;
            }
            if(!/^[0-9]*$/.test($("#cvn2No").val())){
                $("#validCvn2NoTip").html('信用卡CVN2只能为数字');
                return;
            }
            $("#validCvn2NoTip").html('');
        }
        function checkVerifyCode(){
            var verifyCode = $("#verifyCode").val();
            if(verifyCode=='' || $.trim(verifyCode).length !=6){
                $("#verifyCodeTip").html('短信验证码输入错误');
                return;
            }else{
                $("#verifyCodeTip").html('');
            }
        }


        function ccfpInfoSaveSubmit(obj){
            var bankPhoneNo = $("#bankPhoneNo").val();
            var verifyCode = $("#verifyCode").val();

            if($.trim($("#cvn2No").val()) == ''){
                $("#validCvn2NoTip").html('信用卡CVN2不能为空');
                return;
            }

            if($.trim(bankPhoneNo) == ''){
                $("#bankPhoneNoTip").html('银行预留手机号不正确');
                return;
            }
            if($.trim(verifyCode) == ''){
                $("#verifyCodeTip").html('短信验证码不能为空');
                return;
            }
            $(obj).attr('disabled','disabled');

            $.post(ctx+"/sms/check.shtml", {bankPhoneNo: bankPhoneNo, verifyCode: verifyCode}, function(data) {
                if("0" == data.err_code){
                    $("#ccfpInfoSaveForm").submit();
                }else{
                    if(data.action == "1"){
                        $.alert(data.err_msg);
                        $(obj).removeAttr('disabled');
                    }else{
                        $("#verifyCodeTip").html(data.err_msg);
                        $(obj).removeAttr('disabled');
                    }
                }
            },"json");
        }
    </script>
</head>
<body>
<%@include file="../../common/header.jsp"%>
<div class="container1024">
    <div class="container960">
        <!-- 支付订单详情 -->
        <jsp:include page="../payInfoHead.jsp" flush="true"></jsp:include>
        <div class="borderBox-3">
            <div class="titleBox-1">
                <h6>您正在使用${bankName}付款</h6>
            </div>
            <form action="${ctx }/pay/ccfp/save.shtml" method="post" id="ccfpInfoSaveForm" name="ccfpInfoSaveForm">
                <table class="table-tml">
                    <tbody>

                    <tr>
                        <th width="305px">您选择的付款银行：</th>
                        <td>
                            <span class="red"><img width='190' height='36' src="${ctx }/BankIcon/${bankCode}.jpeg" /></span>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label id="reselectClick" style="cursor:pointer;color: blue;">重新选择付款银行</label>
                        </td>
                    </tr>

                    <tr>
                        <th width="305px">已绑定的银行卡号：</th>
                        <td>
                            ${ccardNo} &nbsp;&nbsp;&nbsp;&nbsp;信用卡  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <label id="changeCardClick" style="cursor:pointer;color: blue;" onclick='$("#changeCardForm").submit();'>变更该行信用卡</label>
                        </td>
                    </tr>

                    <tr>
                        <th width="305px">CVN2：</th>
                        <td style="position: relative">
                            <input type="text" class="width120" name="cvn2No" id="cvn2No" onblur="checkCvn2No();"/>
                            <img id="cvn2PromptImg" src="${ctx}/static/img/cvn2.gif" style="position: absolute;left:138px;top:0px;display: none;"/>
                            <span id="validCvn2NoTip" style="color:red;"></span>
                        </td>
                    </tr>

 					<tr>
                        <th width="305px">银行预留手机号：</th>
                        <td>
                            ${bankPhoneNo}
                        </td>
                    </tr>
                    
                    <tr>
                        <th width="305px">短信验证码：</th>
                        <td>
                            <input type="text" class="width120" name="verifyCode" id="verifyCode" maxlength="8" onblur="checkVerifyCode();"/>&nbsp;&nbsp;<button type="button" id="getSmsCode" onclick="sendSms(this);return false;">获取验证码</button>
                            <span id="verifyCodeTip" style="color: red;"></span>
                        </td>
                    </tr>

                    <tr>
                        <td colspan="2" align="center" height="100px"><button type="button" id="payConfirmSubmitId" class="btn-1" onclick="ccfpInfoSaveSubmit(this);">确认支付</button></td>
                    </tr>
                    </tbody>
                </table>
                <input type="hidden" name="formhash" id="formhash" value="${formhash }"/>
                <input type="hidden" name="orderId" id="orderId" value="${orderId }"/>
                <input type="hidden" id="bankPhoneNo" name="bankPhoneNo" value="${bankPhoneNo}">
                <input type="hidden" id="bankCode" name="bankCode" value="${bankCode}">
            </form>
        </div>
    </div>
    <br>
</div>
<form action="${ctx }/pay/ccfp/changeCcfCard.shtml" id="changeCardForm" name="changeCardForm" method="post">
    <input type="hidden" id="cardPhoneNo" name="cardPhoneNo" value="${bankPhoneNo}">
    <input type="hidden" id="epCardBindId" name="epCardBindId" value="${epCardBindId}">
    <input type="hidden" id="epCardBindCustId" name="epCardBindCustId" value="${epCardBindCustId}">
</form>
<%@include file="../../common/footer.jsp"%>
</body>
</html>
<div id="reselectCcfBanksDialog" style="display:none">
    <%@include file="reselectBank.jsp"%>
</div>